<div id="load" style="position: relative;">
    <table class="table">
        @include('users.filter')
        <thead>
            <tr>
                <th>{{ trans('corebg.users.index.email') }}</th>
                <th>{{ trans('corebg.users.index.active') }}</th>
                <th>{{ trans('corebg.users.index.last_login_at') }}</th>
                @if (false !== array_search('read-users', array_column(Session::get('user_permissions'), 'slug')))
                  <th></th>
                @endif
                @if (false !== array_search('manage-users', array_column(Session::get('user_permissions'), 'slug')))
                  <th></th>
                @endif
                @if (false !== array_search('delete-users', array_column(Session::get('user_permissions'), 'slug')))
                  <th></th>
                @endif
            </tr>
        </thead>
        <tbody>
            @foreach ($results as $key => $user)
                <tr>
                    <td>{{ $user['email'] }} </td>
                    <td>{{ $user['active'] ? trans('corebg.yes') : trans('corebg.no') }} </td>
                    <td>{{ $user['last_login_at'] }} </td>
                    @if (false !== array_search('read-users', array_column(Session::get('user_permissions'), 'slug')))
                      <td>
                        <a href="{{ $fullEndpoint }}/{{ $user['id'] }}?include[]=picture&include[]=role&include[]=person&include[]=company">
                          <span class="fas fa-eye" style="cursor:pointer" title="{{ trans('corebg.show') }}" data-id={{ $user['id'] }}>
                          </span>
                        </a>
                      </td>
                    @endif
                    @if (false !== array_search('manage-users', array_column(Session::get('user_permissions'), 'slug')))
                      <td>
                        <a href="{{ $fullEndpoint }}/edit/{{ $user['id'] }}?include[]=picture&include[]=role&include[]=person&include[]=company">
                        <span class="fas fa-edit" style="cursor:pointer" title="{{ trans('corebg.edit') }}" data-id={{ $user['id'] }} >
                        </span>
                      </td>
                    @endif
                    @if (false !== array_search('delete-users', array_column(Session::get('user_permissions'), 'slug')))
                      <td><span class="fas fa-trash" style="cursor:pointer" title="{{ trans('corebg.delete') }}" data-id={{ $user['id'] }}></span></td>
                    @endif
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
